package com.yunji.storage.enums;

import java.util.Objects;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.storage.enums
 * @Title: AllocateStatus
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-08-21 10:27:30      V1.0        HuaAo       新建类
 */

public enum AllocateStatus {
    DRAFT(0, "草稿"),
    WAIT_OUT_STORAGE(1, "待出库"),
    WAIT_RECEIVE(2, "待收货"),
    FINISH(3, "已完成"),
    CANCEL(4, "已取消"),
    SCRAP(5, "作废");

    private final Integer code;
    private final String text;

    AllocateStatus(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public static String get(Integer code) {
        AllocateStatus[] enums = AllocateStatus.values();
        for (AllocateStatus e : enums) {
            if (Objects.equals(e.code, code)) {
                return e.text;
            }
        }
        return null;
    }
}